<template>
  <div class="detailBottomBar">
    <div class="bottomBarTop">
      <div class="bottomBarLeft">
        <div class="especially">
          <i class="icon serve"></i>
          客服
        </div>
        <div class="especially">
          <i class="icon shop"></i>
          店铺
        </div>
        <div class="especially">
          <i class="icon collect"></i>
          收藏
        </div>
      </div>
      <div class="bottomBarRight bottom">
        <div class="addCart purchase" @click="shoppingCartClick">加入购物车</div>
        <div class="buy purchase">购买</div>
      </div>
    </div>
    <tips v-if="showTips" text="添加成功，在购物车等亲~"/>
  </div>
</template>

<script>
  import {shoppingTrolley} from "network/detail";
  import Tips from "components/content/tips/Tips";


  export default {
    name: "DetailBottomBar",
    components: {
      Tips
    },
    data(){
      return {
        id: null,
        itemInfo: null,
        collectImg: false,
        showTips: false
      }
    },
    methods: {
      shoppingCartClick(){
        this.showTips = !this.showTips;
        setTimeout(() => {
          this.showTips = false;
        },3000);
        this.id = this.$route.params.id;
        this.itemInfo = this.$parent.result.itemInfo;
        this.$store.commit('setCartList',new shoppingTrolley(this.itemInfo,this.id));
      }
    }
  }
</script>

<style scoped>
  .bottomBarTop{
    background: #ffffff;
    height: 50px;
    display: flex;
    flex: 1;
  }
  .bottomBarTop .bottomBarLeft{
    display: flex;
    flex: 1;
    text-align: center;
    font-size: 13px;
  }
  .bottomBarTop .bottomBarLeft .icon{
    display: block;
    width: 22px;
    height: 22px;
    margin: 10px auto 3px;
    background: url("~assets/images/detail/detail_bottom.png") 0 0/100%;
  }
  .bottomBarTop .bottomBarLeft .especially{
    flex: 1;
  }
  .bottomBarTop .bottomBarLeft .serve{
    background-position:0 -54px;
  }
  .bottomBarTop .bottomBarLeft .shop{
    background-position:0 -98px;
  }
  .bottomBarTop .bottomBarLeft .collect{
    background-position:0 -150px;
  }
  .bottomBarRight{
    display: flex;
    font-size: 15px;
    text-align: center;
    line-height: 50px;
    flex: 1;
  }
  .bottomBarRight .addCart{
    background-color: orange;
    color: #ffffff;
  }
  .bottomBarRight .buy{
    background-color: #f69;
    color: white;
  }
  .bottomBarRight .purchase{
    flex: 1;
  }
</style>